import Vue from "vue";
import VueRouter from "vue-router";
import Home from "../views/Home.vue";
import Login from "../views/site/Login";
import Test from "../views/Test";
// 车辆燃油分类
import FuelList from "../views/fuel/list";
// 车辆类型分类
import TypeList from "../views/type/list";
import TypeAdd from "../views/type/add";
import TypeEdit from "../views/type/edit";
// 车辆保有量
import QuantityList from "../views/quantity/list";
import QuantityAdd from "../views/quantity/add";
import QuantityEdit from "../views/quantity/edit";
// 商业端数据
import BusinessList from "../views/business/list";
import BusinessAdd from "../views/business/add";
import BusinessEdit from "../views/business/edit";
// 终端数据
import ClientList from "../views/client/list";
import ClientAdd from "../views/client/add";
import ClientEdit from "../views/client/edit";
// 进出口数据
import ExportList from "../views/export/list";
import ExportAdd from "../views/export/add";
import ExportEdit from "../views/export/edit";
// 工业数据数据
import IndustrialList from "../views/industrial/list";
import IndustrialAdd from "../views/industrial/add";
import IndustrialEdit from "../views/industrial/edit";
// 政策
import PolicyList from "../views/policy/list";
import PolicyAdd from "../views/policy/add";
import PolicyEdit from "../views/policy/edit";
// 标准
import StandardList from "../views/standard/list";
import StandardAdd from "../views/standard/add";
import StandardEdit from "../views/standard/edit";
// 奖项
import AwardList from "../views/award/list";
import AwardAdd from "../views/award/add";
import AwardEdit from "../views/award/edit";
// 研究报告
import ResearchReportList from "../views/researchreport/list";
import ResearchReportAdd from "../views/researchreport/add";
import ResearchReportEdit from "../views/researchreport/edit";
// 行业报告
import IndustryReportList from "../views/industryreport/list";
import IndustryReportAdd from "../views/industryreport/add";
import IndustryReportEdit from "../views/industryreport/edit";
// 产业园
import ParkList from "../views/park/list";
import ParkAdd from "../views/park/add";
import ParkEdit from "../views/park/edit";
// 问题
import QuestionList from "../views/question/list";
// 答案
import AnswerShow from "../views/answer/show";

// 留言板
import MessageBoardList from "../views/messageboard/list";
import MessageBoardShow from "../views/messageboard/show";

import tongji from "../views/tongji/index";

const routerPush = VueRouter.prototype.push;

VueRouter.prototype.push = function(location) {
  return routerPush.call(this, location).catch(error => error);
};

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "Home",
    redirect: "/dashboard"
    // component: Home
  },
  {
    path: "/dashboard",
    name: "dashboard",
    component: Home,
    children: [
      {
        path: "/test",
        name: "Test",
        component: Test
      },
      {
        path: "/fuel",
        name: "Fuel",
        component: FuelList,
        meta: {
          title: "冷藏车燃料类型统计"
        }
      },
      {
        path: "/type",
        name: "Type",
        component: TypeList,
        children: []
      },
      {
        path: "/type/add",
        name: "TypeAdd",
        component: TypeAdd
      },
      {
        path: "/type/edit/:id",
        name: "TypeEdit",
        component: TypeEdit
      },
      {
        path: "/quantity",
        name: "QuantityList",
        component: QuantityList,
        children: []
      },
      {
        path: "/quantity/add",
        name: "QuantityAdd",
        component: QuantityAdd
      },
      {
        path: "/quantity/edit/:id",
        name: "QuantityEdit",
        component: QuantityEdit
      },
      {
        path: "/business",
        name: "BusinessList",
        component: BusinessList,
        children: []
      },
      {
        path: "/business/add",
        name: "BusinessAdd",
        component: BusinessAdd
      },
      {
        path: "/business/edit/:id",
        name: "BusinessEdit",
        component: BusinessEdit
      },
      {
        path: "/client",
        name: "ClientList",
        component: ClientList,
        children: []
      },
      {
        path: "/client/add",
        name: "ClientAdd",
        component: ClientAdd
      },
      {
        path: "/client/edit/:id",
        name: "ClientEdit",
        component: ClientEdit
      },
      {
        path: "/export",
        name: "Export",
        component: ExportList,
        children: []
      },
      {
        path: "/export/add",
        name: "ExportAdd",
        component: ExportAdd
      },
      {
        path: "/export/edit/:id",
        name: "ExportEdit",
        component: ExportEdit
      },
      {
        path: "/policy",
        name: "PolicyList",
        component: PolicyList
      },
      {
        path: "/policy/add",
        name: "PolicyAdd",
        component: PolicyAdd
      },
      {
        path: "/policy/edit/:id",
        name: "PolicyEdit",
        component: PolicyEdit
      },
      {
        path: "/standard",
        name: "StandardList",
        component: StandardList
      },
      {
        path: "/standard/add",
        name: "StandardAdd",
        component: StandardAdd
      },
      {
        path: "/standard/edit/:id",
        name: "StandardEdit",
        component: StandardEdit
      },
      {
        path: "/award",
        name: "AwardList",
        component: AwardList
      },
      {
        path: "/award/add",
        name: "AwardAdd",
        component: AwardAdd
      },
      {
        path: "/award/edit/:id",
        name: "AwardEdit",
        component: AwardEdit
      },
      {
        path: "/industrial",
        name: "IndustrialList",
        component: IndustrialList
      },
      {
        path: "/industrial/add",
        name: "IndustrialAdd",
        component: IndustrialAdd
      },
      {
        path: "/industrial/edit/:id",
        name: "IndustrialEdit",
        component: IndustrialEdit
      },
      {
        path: "/researchreport",
        name: "ResearchReportList",
        component: ResearchReportList
      },
      {
        path: "/researchreport/add",
        name: "ResearchReportAdd",
        component: ResearchReportAdd
      },
      {
        path: "/researchreport/edit/:id",
        name: "ResearchReportEdit",
        component: ResearchReportEdit
      },
      {
        path: "/industryreport",
        name: "IndustryReportList",
        component: IndustryReportList
      },
      {
        path: "/industryreport/add",
        name: "IndustryReportAdd",
        component: IndustryReportAdd
      },
      {
        path: "/industryreport/edit/:id",
        name: "IndustryReportEdit",
        component: IndustryReportEdit
      },
      {
        path: "/park",
        name: "ParkList",
        component: ParkList
      },
      {
        path: "/park/add",
        name: "ParkAdd",
        component: ParkAdd
      },
      {
        path: "/park/edit/:id",
        name: "ParkEdit",
        component: ParkEdit
      },
      {
        path: "/question",
        name: "QuestionList",
        component: QuestionList
      },
      {
        path: "/answer/show/:id",
        name: "AnswerShow",
        component: AnswerShow
      },
      {
        path: "/messageboard",
        name: "MessageBoardList",
        component: MessageBoardList
      },
      {
        path: "/messageboard/show/:id",
        name: "MessageBoardShow",
        component: MessageBoardShow
      },
      {
        path: "/tongji",
        name: "tongji",
        component: tongji
      }
    ]
  },
  {
    path: "/login",
    name: "Login",
    component: Login
  }
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes
});

export default router;
